# —————————— 获取网页源代码 ——————————
# import requests
# # 准备URL
# base_url = 'https://www.baidu.com/'
# # 根据URL构造请求，发送GET请求，接收服务器返回的响应信息
# response = requests.get(url=base_url)
# # 设置响应内容的编码格式
# response.encoding = 'utf-8'
# # 查看响应内容
# print(response.text)






# # —————————— 获取图片 ——————————
import requests
url = "https://www.cdutetc.cn/site/cms_22/upload/image/20241011/1728610802537082076.jpg"
response = requests.get(url)
# print(response.content)
# 将二进制数据写入程序所在目录下的baidu_logo.png文件中
with open('cdu_logo.png', 'wb') as file:
    file.write(response.content)


